package com.exam.c;

public class Vthread {

    public static void main(String[] args) throws InterruptedException {
        System.out.println("Hello, virtual thread 000 !");

        Thread.ofVirtual().start(() -> {
            System.out.println("Hello, virtual thread 111 !");
        });

        // 或者指定名字
        Thread.ofVirtual().name("virtual thread").start(() -> {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("Hello, virtual thread 222 !");
        });
        Thread.sleep(5000);
        System.out.println("Hello, virtual thread 333 !");
    }

}
